package com.ict.ms.port.service.api.impl;


import org.springframework.stereotype.Service;

import com.ict.ms.port.facade.api.IPortsSearchService;
import com.ict.ms.port.facade.model.PortinfoSearchLoLa_simp;
import com.ict.ms.port.service.dao.IPortsSearchDao;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by FCC on 2017/2/23.
 */
@Service("portsSearchService")
public class PortsSearchService implements IPortsSearchService {
    @Resource
    IPortsSearchDao portsSearchDao;

    //获取港口名有多少条数
    public int getPortsInt(String portName) {
        int num = 0;
        try {
            num = portsSearchDao.getPortsInt(portName);
        } catch (Exception e) {
            System.out.println("访问数据库失败" + e);
            return num;
        }
        return num;
    }

    //港口定位信息
    public List<PortinfoSearchLoLa_simp> getPortsNames(String portname) {
        List<PortinfoSearchLoLa_simp> portsNames;
        try {
            portsNames = portsSearchDao.getPortsNames(portname);
        } catch (Exception e) {
            System.out.println("访问数据库失败" + e);
            return portsNames = null;
        }
        return portsNames;
    }

    public List<PortinfoSearchLoLa_simp> getPortByLoLa() {
        List<PortinfoSearchLoLa_simp> portsNames;
        try {
            portsNames = portsSearchDao.getPortByLoLa();
        } catch (Exception e) {
            System.out.println("访问数据库失败" + e);
            return portsNames = null;
        }
        return portsNames;
    }
}
